﻿using System;
using ztn_iot_sdk_cSharp.res;

namespace ztn_iot_sdk_cSharp
{
    class IotTokenTool
    {
        private const string BASE_PATH = "iot/api/v1/v1/token/";

        public static Token refresh(TokenGetReqV1 req)
        {
            String path = BASE_PATH + "get";

            BaseRes<Token> res = HttpTool.doPost<BaseRes<Token>>(path, JsonTool.toJson(req));
            if (null != res && null != res.data)
            {
                HttpTool.token = res.data.accessToken;
                return res.data;
            }
            return null;
        }


    }
}
